home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekikoh Dennoh Club 5
/
Gekikoh Dennoh Club Vol. 5 (Japan).7z
/
Gekikoh Dennoh Club Vol. 5 (Japan) (Track 01).bin
/
internet
/
webx
/
webxp040.lzh
/
Source
/
Html2Xpression.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-09-27
|
40KB
|
1,590 lines
/* HTML âtâ@âCâïé≡ Xpression î`Ä«é╔ò╧è╖ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/dos.h>
#include <alloca.h>
#include "WebXpression.h"
#include "Jis2sjis.h"
#include "Tag.h"
#include "Entity.h"
#include "WebCache/WebCache.h"
#include "FuncUrl/FuncUrl.h"
/* É▄éΦò╘é╖âhâbâgÉö */
#define WRAP_DOT (short)512
#define LINE_Y 16
#define ALIGN_LEFT 0
#define ALIGN_RIGHT 1
#define ALIGN_CENTER 2
#define YOYUU 1024
extern IMAGE_LIST *InsertImageNode (char *);
extern IMAGE_LIST *SearchImageNode (char *);
extern void McPrint (char *);
extern void McDbPrint (char *);
extern int line_table_size;
extern int link_table_size;
extern int link_table_buffer_size;
extern int image_table_size;
extern int anchor_table_size;
extern char kmode;
unsigned short html_color[8];
unsigned short config_color[8];
//char color_assigned; /* HTML Æåé┼ÉFé¬ÄwÆΦé│éΩé╜é⌐ */
extern char color_mode; /* WebXpression.cnf é┼ÄwÆΦé│éΩé╜ÉFé≡Ägéñé⌐ */
/* æOìsì\æóæ╠ (Before Line Buffer) */
typedef struct _blb {
struct _blb *before_ptr;/* æOé╠ì\æóæ╠é╓é╠â|âCâôâ^ */
struct _blb *next_ptr; /* ăé╠ì\æóæ╠é╓é╠â|âCâôâ^ */
char text[1024]; /* âeâLâXâgû{æ╠ */
char *ptr; /* âeâLâXâgé╓é╠â|âCâôâ^ */
unsigned short start_dot; /* ì╢Æ[é⌐éτë╜âhâbâgû┌é⌐éτò\ĪèJÄné╖éΘé⌐ */
//unsigned char font_size;
unsigned short font_size;
unsigned short w;
} BLB;
static BLB *blb_top, *blb_end;
static char tag_href_str[256];
static int entity_len[sizeof (entity_str) / sizeof (char *)- 1];
void InitHtml2Xpression (void)
{
short h;
for (h = 0; h < (sizeof (entity_str) / sizeof (char *)- 1); h++)
entity_len[h] = strlen (entity_str[h]);
}
/* t1 é╠Äwé╖â^âOü^âAâgâèârâàü[âgé≡ attr_no é╔ò╘é╖ */
/* t1 é╠Äwé╖ò╢ÄÜù± = æσò╢ÄÜü^żò╢ÄÜë┬ ü^ str é╠Äwé╖ò╢ÄÜù± = æσò╢ÄÜé╠é▌ */
/* ò╘éΦÆl : ăé╠ t1 */
static unsigned char *SearchIItem (unsigned char *t1, char **str, short *attr_no)
{
char **s = str;
short no = 0;
do {
unsigned char *p1 = *s, *p2 = t1;
for (;;) {
unsigned char c1, c2;
if (c1 = *p1++) {
c2 = *p2++;
if ((c1 != c2) && (c1 != (c2 & 0xdf)))
break;
} else {
c2 = *p2++;
if ((c2 == 0) || (c2 == ' ') || (c2 == 0x09) || (c2 == 0x0a) || (c2 == 0x0d)) {
while (c2 = *p2, ((c2 == ' ') || (c2 == 0x09) || (c2 == 0x0a) || (c2 == 0x0d)))
p2++;
*attr_no = no;
return (p2);
}
if ((c2 == '=') || (c2 == '>')) {
*attr_no = no;
return (--p2); /* t1 é¬ '=' '>' é╠Åπé≡Äwé╖éµéñé╔ */
}
break;
}
}
no++;
} while (*(++s) != NULL);
*attr_no = -1;
return (t1);
}
/* '>' é╠ăé▄é┼âXâLâbâvé╖éΘüBJIS/EUC é┼éαénéj */
static char *SkipLt (char *p1, unsigned char temp_kmode)
{
char *t1 = p1;
unsigned char c;
char aork = 0; /* ASCII or KANJI */
for (;;) {
c = *t1++;
/* JIS Ä₧é╠è┐ÄÜ IN/OUT âtâëâOé╠Åêù¥ */
if (c == 0x1b) {/* ESC */
if (temp_kmode == K_JIS) {
unsigned char c1 = *(t1 + 1);
switch (*t1) {
case '(':
if ((c1 == 'B') || (c1 == 'J')) { /* è┐ÄÜ OUT */
aork = 0;
t1 += 2;
}
break;
case '$':
if ((c1 == '@') || (c1 == 'B')) { /* è┐ÄÜ IN */
aork = !0;
t1 += 2;
}
break;
default:
break;
}
continue;
}
}
//if ((c >= 0xa0) && (c <= 0xdf)) /* ö╝èpâJâié═û│Äï */
//continue;
if (((temp_kmode <= K_EUC) && (c < 0x80)) /* AUTO or SJIS or EUC */
||((temp_kmode == K_JIS) && (!aork))) {
/* éPâoâCâgò╢ÄÜé╠ÅΩìç */
if (c == '>')
break;
} else {
/* è┐ÄÜé╠ÅΩìç */
t1++;
}
}
return (t1);
}
/* âAâgâèârâàü[âgé≡âXâLâbâvé╖éΘ */
static char *SkipAttr (char *p1, unsigned char temp_kmode)
{
char *t1 = p1;
unsigned char c;
char aork = 0; /* ASCII or KANJI */
char quot_flag = 0;
/* û{æ╠é≡âXâLâbâv */
//while (c = *t1, (c != ' ') && (c != 0x09) && (c != 0x0d) && (c != 0x0a) && (c != '='))
//t1++;
//c = *t1;
/* Ælé¬û│éóÅΩìç */
//if (c != '=')
//return (t1);
t1++; /* '=' é╠é╘é± */
c = *t1;
if (c == '"') {
quot_flag = 1;
t1++;
}
if (c == '\'') {
quot_flag = 2;
t1++;
}
for (;;) {
c = *t1++;
/* JIS Ä₧é╠è┐ÄÜ IN/OUT âtâëâOé╠Åêù¥ */
if (c == 0x1b) {/* ESC */
if (temp_kmode == K_JIS) {
unsigned char c1 = *(t1 + 1);
switch (*t1) {
case '(':
if ((c1 == 'B') || (c1 == 'J')) { /* è┐ÄÜ OUT */
aork = 0;
t1 += 2;
}
break;
case '$':
if ((c1 == '@') || (c1 == 'B')) { /* è┐ÄÜ IN */
aork = !0;
t1 += 2;
}
break;
default:
break;
}
continue;
}
}
//if ((c >= 0xa0) && (c <= 0xdf)) /* ö╝èpâJâié═û│Äï */
//continue;
if (((temp_kmode <= K_EUC) && (c < 0x80)) /* AUTO or SJIS or EUC */
||((temp_kmode == K_JIS) && (!aork))) {
/* éPâoâCâgò╢ÄÜé╠ÅΩìç */
switch (quot_flag) {
case 0:
if ((c == ' ') || (c == 0x09) || (c == 0x0d) || (c == 0x0a))
return (t1);
if (c == '>')
return (--t1);
break;
case 1:
if (c == '"')
return (t1);
break;
case 2:
if (c == '\'')
return (t1);
break;
}
} else {
/* è┐ÄÜé╠ÅΩìç */
t1++;
}
}
return (t1); /* é▒é▒é╔é═ùêé╚éóânâY */
}
/* ò╢ÄÜù±é≡âRâsü[é╖éΘ "" é┼ê═é▄éΩé─éóé─éα JIS/EUC é┼éαénéj */
static char *CopyItem (char *p2, char *p1, unsigned char temp_kmode)
{
char *t1 = p1, *t2 = p2;
unsigned char c;
char aork = 0; /* ASCII or KANJI */
char quot_flag = 0;
while (c = *t1, (c == ' ') || (c == 0x09) || (c == 0x0d) || (c == 0x0a))
t1++;
c = *t1;
if (c == '"') {
quot_flag = 1;
t1++;
}
if (c == '\'') {
quot_flag = 2;
t1++;
}
for (;;) {
c = *t1++;
/* JIS Ä₧é╠è┐ÄÜ IN/OUT âtâëâOé╠Åêù¥ */
if (c == 0x1b) {/* ESC */
if (temp_kmode == K_JIS) {
unsigned char c1 = *(t1 + 1);
switch (*t1) {
case '(':
if ((c1 == 'B') || (c1 == 'J')) { /* è┐ÄÜ OUT */
aork = 0;
t1 += 2;
}
break;
case '$':
if ((c1 == '@') || (c1 == 'B')) { /* è┐ÄÜ IN */
aork = !0;
t1 += 2;
}
break;
default:
break;
}
continue;
}
}
if (c < ' ') {
//*t2++ = c;
continue;
}
//if ((c >= 0xa0) && (c <= 0xdf)) /* ö╝èpâJâié═û│Äï */
//continue;
if (((temp_kmode <= K_EUC) && (c < 0x80)) /* AUTO or SJIS or EUC */
||((temp_kmode == K_JIS) && (!aork))) {
/* éPâoâCâgò╢ÄÜé╠ÅΩìç */
switch (quot_flag) {
case 0:
if ((c == ' ') || (c == 0x09) || (c == 0x0d) || (c == 0x0a)) {
*t2 = '\0';
return (t1);
}
if (c == '>') {
*t2 = '\0';
return (--t1);
}
break;
case 1:
if (c == '"') {
*t2 = '\0';
return (t1);
}
break;
case 2:
if (c == '\'') {
*t2 = '\0';
return (t1);
}
break;
}
*t2++ = c;
continue;
} else {
/* è┐ÄÜé╠ÅΩìç */
switch (temp_kmode) {
case K_AUTO:
case K_SJIS:
*t2++ = c;
*t2++ = *t1++;
break;
case K_EUC:
Jis2sjis (((c & 0x7f)), (*t1++ & 0x7f), t2);
break;
case K_JIS:
Jis2sjis (c, *t1++, t2);
break;
}
continue;
}
}
return (t1); /* é▒é▒é╔é═ùêé╚éóânâY */
}
/* "#ffffff" é╠éµéñé╚ÉFÄwÆΦé≡ 16bit ÉFé╔ */
static unsigned short Str2Color (char *p)
{
unsigned short col = 0;
short h;
p++;
for (h = 0; h < 6; h++) {
unsigned char c = *p++;
unsigned char s[6] =
{6 + 1, 6, 11 + 1, 11, 1 + 1, 1};
unsigned char a[6] =
{0xf, 0x8, 0xf, 0x8, 0xf, 0x8};
if ((c >= '0') && (c <= '9'))
col |= ((unsigned short) ((c - '0') & a[h])) << s[h];
else
col |= ((unsigned short) (((c & 0xdf) - 'A' + 10) & a[h])) << s[h];
}
col |= 1; /* 0x0000 é╛é╞é▄é╕éóé╠é┼ */
return (col);
}
/* ûûö÷é╔âmü[âh(BLB)é≡éPé┬Æ╟ë┴é╖éΘ */
static BLB *InsertNodeBLB (signed short nest,
unsigned char c, unsigned char c1, unsigned short font_size, unsigned short w,
short image_table_max, int hh, int y_offset)
{
BLB *t_ptr = blb_top;
signed short h = nest;
/* âèâXâgé≡îƒì⌡é╡é─éáéΩé╬é╗é╠â|âCâôâ^üAé╚é»éΩé╬ì∞ɼé╡é─é╗é╠â|âCâôâ^é≡ò╘é╖ */
while (--h != 0) {
t_ptr = t_ptr->next_ptr;
};
if (t_ptr == NULL) {
/* é╚é⌐é┴é╜é╠é┼ì∞ɼ */
if ((t_ptr = malloc (sizeof (BLB))) == NULL) {
McPrint ("InsertNodeBLB() : âüâéâèé¬æ½éΦé▄é╣é±\n");
return (NULL);
} else {
if (blb_top == NULL) {
/* âmü[âhéOî┬é╠Åèé╔Æ╟ë┴ */
blb_top = t_ptr;
blb_end = t_ptr;
t_ptr->before_ptr = NULL;
t_ptr->next_ptr = NULL;
} else {
/* ûûö÷é╔âmü[âhé≡Æ╟ë┴ */
(blb_end)->next_ptr = t_ptr;
t_ptr->before_ptr = blb_end;
t_ptr->next_ptr = NULL;
blb_end = t_ptr;
}
*(t_ptr->text) = '\0';
t_ptr->ptr = &(t_ptr->text[0]);
t_ptr->start_dot = 0;
t_ptr->font_size = 0;
t_ptr->w = 0;
}
}
if ((c) || (c1)) {
/* æσé½éóò╢ÄÜé╠æOìsÅêù¥ */
if (!c1) {
/* éPâoâCâgò╢ÄÜ */
if ((t_ptr->font_size == font_size) && (t_ptr->w + t_ptr->font_size == w)) {
/* æOë±é╞ô»é╢âtâHâôâgâTâCâYé╠ÿAæ▒é╖éΘò╢ÄÜé╚éτ */
*t_ptr->ptr++ = c;
t_ptr->w = w;
} else {
t_ptr->font_size = font_size;
t_ptr->w = w;
t_ptr->ptr += sprintf (t_ptr->ptr, "`D%dS%d`", w, font_size);
*t_ptr->ptr++ = c;
}
} else {
/* éQâoâCâgò╢ÄÜ */
if ((t_ptr->font_size == font_size) && (t_ptr->w + t_ptr->font_size * 2 == w)) {
/* æOë±é╞ô»é╢âtâHâôâgâTâCâYé╠ÿAæ▒é╖éΘò╢ÄÜé╚éτ */
*t_ptr->ptr++ = c;
*t_ptr->ptr++ = c1;
t_ptr->w = w;
} else {
t_ptr->font_size = font_size;
t_ptr->w = w;
t_ptr->ptr += sprintf (t_ptr->ptr, "`D%dS%d`", w, font_size);
*t_ptr->ptr++ = c;
*t_ptr->ptr++ = c1;
}
}
} else {
/* æσé½éóâCâüü[âWé╠æOìsÅêù¥ */
t_ptr->w = w;
if (*tag_href_str) { /* âèâôâNé¬éáéΘé⌐üH */
t_ptr->ptr += sprintf (t_ptr->ptr, "`D%d`%s`G%d,%d,%x``lu`",
w, tag_href_str, image_table_max, hh, y_offset);
} else {
t_ptr->ptr += sprintf (t_ptr->ptr, "`D%dG%d,%d,%xU`",
w, image_table_max, hh, y_offset);
}
}
*t_ptr->ptr = '\0';
return (t_ptr);
}
/* ûûö÷é╠âmü[âh(BLB)é≡ìφÅ£é╖éΘüiÄ└ì█é╔é═ìφÅ£é╡é╚éóüj */
static BLB *DeleteNodeBLB (void)
{
BLB *t_ptr = blb_end;
if (blb_top == NULL)
return (NULL);
if (blb_end->before_ptr == NULL) {
/* éPé┬é╡é⌐é╚éóâmü[âhé≡ìφÅ£é╖éΘ */
blb_top = NULL;
blb_end = NULL;
} else {
(blb_end->before_ptr)->next_ptr = NULL;
blb_end = blb_end->before_ptr;
}
return (t_ptr);
}
XPTEXT *Html2Xpression (HTTPFILE * httpfile, XPTEXT * old_xptext)
{
XPTEXT *xptext; /* ò╘éΦÆl */
LINE_PTR *l; /* î╗ì▌Åêù¥é╡é─éóéΘìsâeü[âuâï */
unsigned short w; /* âhâbâgÉö */
//register unsigned short w asm ("d7"); /* âhâbâgÉö */
//unsigned char *t1, *t2; /* î╗ì▌Åêù¥é╡é─éóéΘò╢ÄÜ */
register unsigned char *t1 asm ("a4"); /* î╗ì▌Åêù¥é╡é─éóéΘò╢ÄÜüiô]æùî│üj */
register unsigned char *t2 asm ("a5"); /* üV üiô]æùɵüj */
unsigned char *t1e, *t2e; /* t1,t2 é╠ûûö÷ */
unsigned char *t1_old; /* üuÅêù¥é╡é╜ò╢ÄÜé≡ô╟é▄é╚é⌐é┴é╜Äûé╔é╖éΘüvùp */
unsigned char *t2t; /* é╗é╠ìsé╠ɵô¬é╠ t2 */
unsigned int t2_size = 0; /* t2 é╠âTâCâY */
//unsigned char c; /* Åêù¥é╖éΘò╢ÄÜ */
register unsigned char c asm ("d7"); /* Åêù¥é╖éΘò╢ÄÜ */
unsigned char *tag_head = NULL; /* <head>é╠ăé╠âAâhâîâX */
unsigned char *tag_title = NULL; /* <title>é╠ăé╠âAâhâîâX */
unsigned char tag_href = 0;
unsigned char align = ALIGN_LEFT; /* ìsæ╡éªâéü[âh */
unsigned char tag_center = 0;
unsigned char tag_p_align = 0;
unsigned char tag_pre = 0;
unsigned char tag_ol = 0;
unsigned char tag_ul = 0;
unsigned short tag_list_no = 0;
#if 0
unsigned char tag_bold = 0;
unsigned char tag_italic = 0;
unsigned char tag_underline = 0;
unsigned char font_type = 0;
#endif
//unsigned char font_size = 6; /* ö╝èpò╢ÄÜé╠æσé½é│ */
unsigned short font_size = 6; /* ö╝èpò╢ÄÜé╠æσé½é│ */
//register unsigned char font_size asm ("d6") = 6; /* ö╝èpò╢ÄÜé╠æσé½é│ */
unsigned char font_size_stack[256];
unsigned char font_size_stackptr = 0;
unsigned char space_flag = 0; /* Æ╝æOé¬ö╝èpâXâyü[âXé╛é┴é╜é⌐ */
unsigned short ffifo_ptr = 0;
char ffifo[256];
char *link_table_buffer_ptr = NULL;
char scheme[256], hostname[256], path[256], fname[256], query[256], anchor[256];
int port;
HTTPFILE *httpfile2; /* âeâôâ|âëâèùp */
unsigned char pass; /* =0:éPâpâXû┌ =!0:éQâpâXû┌ */
unsigned char temp_kmode = kmode; /* ò╢ÄÜâRü[âh */
char aork = 0; /* JIS ùp ASCII(=0) or KANJI(=!0) */
char reset_align = 0;
unsigned short org_line = 0; /* î│é╠ HTML é╠ë╜ìsû┌é╛é┴é╜é⌐ */
xptext = _dos_malloc (sizeof (XPTEXT));
xptext->text = NULL;
xptext->line_ptr = NULL;
xptext->anchor_table = NULL;
*(xptext->title) = '\0';
strcpy (xptext->title, "â^âCâgâïûóÉ▌ÆΦ");
httpfile2 = alloca (sizeof (HTTPFILE));
if (old_xptext) /* éPâpâXû┌é⌐üH */
pass = !0;
else
pass = 0;
if (!pass) {
short h;
for (h = 0; h < 8; h++)
html_color[h] = config_color[h];
}
#define XPTEXT_BUFFER_YOYUU 32768
/* é▒éΩê╩éáéΩé╬æ½éΦéΘé⌐é╚üH */
t2_size = httpfile->content_length * 2 + XPTEXT_BUFFER_YOYUU;
if ((xptext->text = _dos_malloc (t2_size)) == NULL) {
McPrint ("üª âüâéâèé¬æ½éΦé▄é╣é±üiâeâLâXâgâoâbâtâ@ùpé╠âüâéâèé¬èmò█é┼é½é▄é╣é±üj\n");
return (NULL);
}
/* ùvé╖éΘé╔ *t1üié╫é╜ô╟é▌é╡é╜ .HTMüjé⌐éτ *t2 é╔É«î`é╡é╚é¬éτâRâsü[é╡é─éóé¡éφé»é╛ */
t1 = httpfile->content; /* html âtâ@âCâïû{æ╠é╓é╠â|âCâôâ^ */
t1e = t1 + httpfile->content_length; /* t1 é¬ t1e é╔ÆBé╡é╜éτÅIù╣ */
t2 = xptext->text; /* xptext âoâbâtâ@é╓é╠â|âCâôâ^ */
t2e = t2 + t2_size - YOYUU;
/* t2 é¬ t2e é╔ÆBé╡é╜éτÅIù╣üiâoâbâtâ@òsæ½üj */
/* é╞éΦéáéªé╕î┼ÆΦâTâCâYé┼èmò█ */
if ((xptext->line_ptr = _dos_malloc (sizeof (LINE_PTR) * line_table_size)) == NULL) {
McPrint ("üª âüâéâèé¬æ½éΦé▄é╣é±üiìsô¬âèâXâgùpâüâéâèé¬èmò█é┼é½é▄é╣é±üj\n");
return (NULL);
}
l = xptext->line_ptr;
xptext->line = 0;
xptext->current_line = 0;
/* é╞éΦéáéªé╕î┼ÆΦâTâCâYé┼èmò█ */
if ((xptext->anchor_table = _dos_malloc (sizeof (ANCHOR_TABLE) * anchor_table_size)) == NULL) {
McPrint ("üª âüâéâèé¬æ½éΦé▄é╣é±üiâAâôâJü[âeü[âuâïùpé╠âüâéâèé¬èmò█é┼é½é▄é╣é±üj\n");
return (NULL);
}
xptext->anchor_table_max = 0;
if (!pass) {
/* Åëë±é╠ë≡É═é╚éτ */
xptext->link_table = NULL;
xptext->link_table_buffer = NULL;
xptext->image_table = NULL;
/* é╞éΦéáéªé╕î┼ÆΦâTâCâYé┼èmò█ */
if ((xptext->link_table = _dos_malloc (sizeof (LINK_TABLE) * link_table_size)) == NULL) {
McPrint ("üª âüâéâèé¬æ½éΦé▄é╣é±üiâèâôâNâeü[âuâïùpé╠âüâéâèé¬èmò█é┼é½é▄é╣é±üj\n");
return (NULL);
}
/* é╞éΦéáéªé╕î┼ÆΦâTâCâYé┼èmò█ */
if ((xptext->link_table_buffer = _dos_malloc (sizeof (unsigned char) * link_table_buffer_size)) == NULL) {
McPrint ("üª âüâéâèé¬æ½éΦé▄é╣é±üiâèâôâNâeü[âuâïâoâbâtâ@ùpé╠âüâéâèé¬èmò█é┼é½é▄é╣é±üj\n");
return (NULL);
}
link_table_buffer_ptr = xptext->link_table_buffer;
UrlSplit (httpfile->url, scheme, hostname, path, fname, query, anchor, &port);
/* é╞éΦéáéªé╕î┼ÆΦâTâCâYé┼èmò█ */
if ((xptext->image_table = _dos_malloc (sizeof (IMAGE_TABLE) * image_table_size)) == NULL) {
McPrint ("üª âüâéâèé¬æ½éΦé▄é╣é±üiâCâüü[âWâeü[âuâïùpé╠âüâéâèé¬èmò█é┼é½é▄é╣é±üj\n");
return (NULL);
} { /* debug âoâOé┴é─éα NULL â|âCâôâ^é┼Ä~é▄éΘéµéñé╔ */
short h;
for (h = 0; h < image_table_size; h++)
(xptext->image_table)[h].image_list = NULL;
}
} else {
/* éQë±û┌ê╚ì~é╠ë≡É═é╚éτ */
xptext->image_table = old_xptext->image_table;
temp_kmode = old_xptext->kmode;
}
xptext->link_table_max = 0;
xptext->image_table_max = 0;
/* ìsâïü[âv */
do {
blb_top = NULL;
blb_end = NULL;
w = 0;
t2t = t2;
space_flag = 0;
if (ffifo_ptr) {
switch (ffifo[--ffifo_ptr]) {
case 'h':
strcpy (t2, "`S08`ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬ä¬");
w = 64 * 8;
t2 += 69;
break;
case 'l':
if (tag_ol) { /* ö╘ìåòté½âèâXâg */
t2 += sprintf (t2, "%hd:", tag_list_no);
w += font_size * 4;
if (++tag_list_no > 999)
tag_list_no = 1;
} else {
if (tag_ul) { /* ö╘ìåû│é╡âèâXâg */
t2 += sprintf (t2, "üE");
w += font_size * 2;
}
}
break;
case 'd': /* â^âO <dd> */
*t2++ = 0x09;
w = (w + 6 * 8) / (short) (6 * 8) * (short) (6 * 8);
break;
default:
break;
}
ffifo_ptr = 0; /* éóéτé╚éóânâYé╚é±é╛é¬üEüEüE */
}
if (font_size != 6) /* æOìsé⌐éτæσé½éóò╢ÄÜé¬æ▒éóé─éóéΩé╬ */
t2 += sprintf (t2, "`S%d`", font_size);
if (tag_href) /* æOìsé⌐éτâ^âOé¬æ▒éóé─éóéΩé╬ */
t2 += sprintf (t2, "%s", tag_href_str);
*tag_href_str = '\0';
/* îàâïü[âv */
do {
t1_old = t1;
c = *t1++;
if ((c == '<') /* â^âOö¡î⌐üI */
&&((temp_kmode <= K_EUC) /* AUTO or SJIS or EUC */
||((temp_kmode == K_JIS) && (!aork)))) {
short tag_no;
char nl_flag = 0; /* ëⁿìsé╖éΘé╚éτ = !0 */
char not_read_flag = 0; /* ò╢ÄÜé≡ô╟é▄é╚é⌐é┴é╜Äûé╔é╖éΘé╚éτ= !0 */
/* '<' é╠îπé╔âXâyü[âXé¬éáéΩé╬ô╟é▌ö≥é╬é╖ */
while (c = *t1, ((c == ' ') || (c == 0x09) || (c == 0x0a) || (c == 0x0d)))
t1++;
/* t1 é╠Äwé╖â^âOé≡ tag_no é╔ò╘é╖ */
t1 = SearchIItem (t1, tag_str, &tag_no);
/*
é▒é▒é╔ùêé╜Ä₧ô_é┼ t1 é═â^âOé╠ăüiâXâyü[âXé¬éáéΩé╬ô╟é▌ö≥é╬é╖üjé≡Äwé╡
é─éóéΘüB"<A HREF=" é╛é┴é╜éτ 'H'üA"<BR>" é╛é┴é╜éτ">"üB
*/
#if 0
if (tag_no >= 0) {
char temp_str[256];
sprintf (temp_str, "TAG : %s\n", tag_str[tag_no]);
McDbPrint (temp_str);
}
#endif
/* â^âOé╔éµé┴é─ò¬è≥ */
switch (tag_no) {
case TAG_BR:
nl_flag = !0; /* îàâïü[âvé≡ö▓é»éΘ */
break;
case TAG_A:
while (*t1 != '>') {
short attr_no;
t1 = SearchIItem (t1, attr_a_str, &attr_no);
switch (attr_no) {
case ATTR_A_HREF:
while (*t1++ != '=');
if (!pass) {
/* Åëë±é╠ë≡É═é╚éτ */
char temp_str[256], temp_fname[256];
char *t = temp_str;
/* temp_str é╔âRâsü[ */
t1 = CopyItem (t, t1, temp_kmode);
((xptext->link_table)[xptext->link_table_max]).url = link_table_buffer_ptr;
/* "#foo"üiâtâ@âCâïû╝é╚é╡üjé⌐üH */
if (*t == '#')
UrlCat (link_table_buffer_ptr, scheme, hostname, path, fname, query, temp_str, port);
else
UrlCat (link_table_buffer_ptr, scheme, hostname, path, temp_str, query, anchor, port);
strcpy (httpfile2->url, link_table_buffer_ptr);
if (WCExist (httpfile2, temp_fname) > WC_NON)
(xptext->link_table)[xptext->link_table_max].in_cache = !0;
else
(xptext->link_table)[xptext->link_table_max].in_cache = 0;
while (*link_table_buffer_ptr++);
} else {
t1 = SkipAttr (t1, temp_kmode);
}
sprintf (tag_href_str, "`L%dU`", xptext->link_table_max);
t2 += sprintf (t2, "%s", tag_href_str);
tag_href = !0;
xptext->link_table_max++;
break;
case ATTR_A_NAME:
while (*t1++ != '=');
{
char temp_str[256];
char *t = temp_str;
/* temp_str é╔âRâsü[ */
t1 = CopyItem (t, t1, temp_kmode);
temp_str[SIZE_OF_ANCHOR] = '\0';
strcpy (((xptext->anchor_table)[xptext->anchor_table_max]).anchor, temp_str);
((xptext->anchor_table)[xptext->anchor_table_max]).line = xptext->line;
}
xptext->anchor_table_max++;
break;
default:
t1 = SkipAttr (t1, temp_kmode);
break;
}
while (c = *t1, ((c == ' ') || (c == 0x09) || (c == 0x0a) || (c == 0x0d)))
t1++;
}
break;
case _TAG_A:
strcpy (t2, "`lu`");
t2 += 4;
tag_href = 0;
*tag_href_str = '\0';
break;
case TAG_IMG:
while (*t1 != '>') {
short attr_no;
char img_src_flag = 0;
t1 = SearchIItem (t1, attr_img_str, &attr_no);
switch (attr_no) {
case ATTR_IMG_SRC:
while (*t1++ != '=');
img_src_flag = !0;
if (!pass) {
/* Åëë±é╠ë≡É═é╚éτ */
char temp_str[256], temp_url[256];
char *t = temp_str;
IMAGE_LIST *t_ptr;
/* temp_str é╔âRâsü[ */
t1 = CopyItem (t, t1, temp_kmode);
UrlCat (temp_url, scheme, hostname, path, temp_str, "", "", port);
/*
âCâüü[âWâèâXâgé╔æ╢ì▌é╖éΘé⌐
*/
if ((t_ptr = SearchImageNode (temp_url)) == NULL) {
/* æ╢ì▌é╡é╚éóÅΩìç */
t_ptr = InsertImageNode (temp_url);
}
(xptext->image_table)[xptext->image_table_max].image_list = t_ptr;
(xptext->image_table)[xptext->image_table_max].in_cache = 0;
} else {
t1 = SkipAttr (t1, temp_kmode);
}
break;
case ATTR_IMG_WIDTH:
/*
Åëë±é╠ë≡É═é┼é⌐é┬ IMG SRC é≡Åêù¥é╕é▌é╚éτ
*/
if ((!pass) && (img_src_flag)) {
IMAGE_LIST *t_ptr;
t_ptr = (xptext->image_table)[xptext->image_table_max].image_list;
if (!(t_ptr->x)) {
char temp_str[256];
char *t = temp_str;
while (*t1++ != '=');
/*
temp_str é╔âRâsü[
*/
t1 = CopyItem (t, t1, temp_kmode);
if (!(t_ptr->x = atoi (t) / 2))
t_ptr->x = 1;
} else {
t1 = SkipAttr (t1, temp_kmode);
}
} else {
t1 = SkipAttr (t1, temp_kmode);
}
break;
case ATTR_IMG_HEIGHT:
/*
Åëë±é╠ë≡É═é┼é⌐é┬ IMG SRC é≡Åêù¥é╕é▌é╚éτ
*/
if ((!pass) && (img_src_flag)) {
IMAGE_LIST *t_ptr;
t_ptr = (xptext->image_table)[xptext->image_table_max].image_list;
if (!(t_ptr->y)) {
char temp_str[256];
char *t = temp_str;
while (*t1++ != '=');
/*
temp_str é╔âRâsü[
*/
t1 = CopyItem (t, t1, temp_kmode);
if (!(t_ptr->y = atoi (t) / 2))
t_ptr->y = 1;
} else {
t1 = SkipAttr (t1, temp_kmode);
}
} else {
t1 = SkipAttr (t1, temp_kmode);
}
break;
case ATTR_IMG_ALT:
t1 = SkipAttr (t1, temp_kmode);
break;
default:
t1 = SkipAttr (t1, temp_kmode);
}
while (c = *t1, ((c == ' ') || (c == 0x09) || (c == 0x0a) || (c == 0x0d)))
t1++;
}
/* âfü[â^é═âüâéâèÅπé╔éáéΘé⌐ */
{
IMAGE_LIST *t_ptr;
t_ptr = (xptext->image_table)[xptext->image_table_max].image_list;
if ((t_ptr->data == NULL) && (!(t_ptr->x)) && (!(t_ptr->y))) {
if ((short) (w + font_size * 4) > WRAP_DOT) {
/* ô╟é▄é╚é⌐é┴é╜é▒é╞é╔é╖éΘ */
not_read_flag = !0;
t_ptr->count--;
nl_flag = !0;
break;
} else {
strcpy (t2, "[èG]");
t2 += 4;
w += font_size * 4;
}
} else {
short y;
int h = 1, hh, y_offset;
(xptext->image_table)[xptext->image_table_max].disp_x = t_ptr->x;
/* ëµæ£é¬ëEÆ[é⌐éτé═é▌Åoé─é╡é▄éñé⌐üH */
if ((w + t_ptr->x) > WRAP_DOT) {
if (w > 0) {
/* æùéΦï╓æÑé╡é─ë≡îê */
not_read_flag = !0;
t_ptr->count--;
nl_flag = !0; /* ăé╠ìsé╓ */
break;
} else {
/*
é╟éñé╡é─éαëµû╩é╔Ä√é▄éτé╚éó
*/
if (t_ptr->x > WRAP_DOT)
(xptext->image_table)[xptext->image_table_max].disp_x = WRAP_DOT;
}
}
y = t_ptr->y;
if (t_ptr->y < 16) {
hh = 16 - y;
y_offset = 0;
} else {
hh = 0;
y_offset = t_ptr->x * 2 * (t_ptr->y - 16);
}
t2 += sprintf (t2, "`G%d,%d,%x`", xptext->image_table_max, hh, y_offset);
while ((y -= LINE_Y) > 0) {
y_offset -= t_ptr->x * 2 * 16;
if (y_offset < 0) {
y_offset = 0;
hh = 16 - y;
} else {
hh = 0;
}
InsertNodeBLB (h++, 0, 0, 0,
w, xptext->image_table_max, hh, y_offset);
}
w += (xptext->image_table)[xptext->image_table_max].disp_x;
}
}
xptext->image_table_max++;
break;
case TAG_FRAMESET:
t2 += sprintf (t2, "üª é▒é╠âyü[âWé═âtâîü[âÇé¬ÄgéφéΩé─éóé▄é╖");
nl_flag = !0; /* îàâïü[âvé≡ö▓é»éΘ */
break;
case TAG_FRAME:
while (*t1 != '>') {
short attr_no;
t1 = SearchIItem (t1, attr_frame_str, &attr_no);
switch (attr_no) {
case ATTR_FRAME_SRC:
while (*t1++ != '=');
if (!pass) {
/* Åëë±é╠ë≡É═é╚éτ */
char temp_str[256], temp_fname[256];
char *t = temp_str;
/* temp_str é╔âRâsü[ */
t1 = CopyItem (t, t1, temp_kmode);
((xptext->link_table)[xptext->link_table_max]).url = link_table_buffer_ptr;
UrlCat (link_table_buffer_ptr, scheme, hostname, path, temp_str, "", "", port);
strcpy (httpfile2->url, link_table_buffer_ptr);
if (WCExist (httpfile2, temp_fname) > WC_NON)
(xptext->link_table)[xptext->link_table_max].in_cache = !0;
else
(xptext->link_table)[xptext->link_table_max].in_cache = 0;
while (*link_table_buffer_ptr++);
} else {
t1 = SkipAttr (t1, temp_kmode);
}
//ffifo[ffifo_ptr++] = 'f';
sprintf (tag_href_str, "`L%dU`%-.80s`lu`", xptext->link_table_max, ((xptext->link_table)[xptext->link_table_max]).url);
t2 += sprintf (t2, "%s", tag_href_str);
//w += strlen (tag_href_str) * 6;
break;
case ATTR_FRAME_NAME:
default:
t1 = SkipAttr (t1, temp_kmode);
break;
}
while (c = *t1, ((c == ' ') || (c == 0x09) || (c == 0x0a) || (c == 0x0d)))
t1++;
}
xptext->link_table_max++;
nl_flag = !0; /* îàâïü[âvé≡ö▓é»éΘ */
break;
case TAG_BODY:
while (*t1 != '>') {
short attr_no;
signed short no = -1;
t1 = SearchIItem (t1, attr_body_str, &attr_no);
switch (attr_no) {
case ATTR_BODY_TEXT:
no = 1;
break;
case ATTR_BODY_LINK:
no = 3;
break;
case ATTR_BODY_BGCOLOR:
no = 0;
break;
case ATTR_BODY_ALINK:
case ATTR_BODY_VLINK:
default:
break;
}
if ((no >= 0) && (!pass)) {
char temp_str[256];
char *t = temp_str;
while (*t1++ != '=');
t1 = CopyItem (t, t1, temp_kmode);
if (temp_str[0] == '#')
html_color[no] = Str2Color (temp_str);
else
html_color[no] = 1; /* debug */
} else {
t1 = SkipAttr (t1, temp_kmode);
}
while (c = *t1, ((c == ' ') || (c == 0x09) || (c == 0x0a) || (c == 0x0d)))
t1++;
}
break;
case TAG_INPUT:
while (*t1 != '>') {
short attr_no;
#if 0
char temp_str[256], temp_fname[256];
char *t = temp_str;
#endif
t1 = SearchIItem (t1, attr_input_str, &attr_no);
switch (attr_no) {
case ATTR_INPUT_TYPE:
#if 0
while (*t1++ != '=');
/* temp_str é╔âRâsü[ */
t1 = CopyItem (t, t1, temp_kmode);
SearchIItem (t, attr_input_type_str, &attr_no);
switch (attr_no) {
case ATTR_INPUT_TYPE_RADIO:
t2 += sprintf (t2, "`E1`");
break;
case ATTR_INPUT_TYPE_CHECKBOX:
t2 += sprintf (t2, "`E0`");
break;
case ATTR_INPUT_TYPE_RESET:
t2 += sprintf (t2, "`E0`");
break;
case ATTR_INPUT_TYPE_SUBMIT:
t2 += sprintf (t2, "`E0`");
break;
default:
t2 += sprintf (t2, "`E0`");
break;
}
break;
#endif
default:
t1 = SkipAttr (t1, temp_kmode);
break;
}
while (c = *t1, ((c == ' ') || (c == 0x09) || (c == 0x0a) || (c == 0x0d)))
t1++;
}
break;
case TAG_HR:
ffifo[ffifo_ptr++] = 'h';
nl_flag = !0; /* îàâïü[âvé≡ö▓é»éΘ */
break;
case TAG_P:
tag_p_align = !0;
if (!tag_center)
align = ALIGN_LEFT;
while (*t1 != '>') {
short attr_no;
char temp_str[256];
char *t = temp_str;
t1 = SearchIItem (t1, attr_p_str, &attr_no);
switch (attr_no) {
case ATTR_P_ALIGN:
while (*t1++ != '=');
t1 = CopyItem (t, t1, temp_kmode);
if (!stricmp (t, "center"))
align = ALIGN_CENTER;
if (!stricmp (t, "left"))
align = ALIGN_LEFT;
break;
default:
t1 = SkipAttr (t1, temp_kmode);
break;
}
while (c = *t1, ((c == ' ') || (c == 0x09) || (c == 0x0a) || (c == 0x0d)))
t1++;
}
nl_flag = !0; /* îàâïü[âvé≡ö▓é»éΘ */
break;
case _TAG_P:
tag_p_align = 0;
nl_flag = !0; /* îàâïü[âvé≡ö▓é»éΘ */
if (!tag_center)
reset_align = !0;
break;
case TAG_H1:
case TAG_H2:
font_size_stack[font_size_stackptr++] = font_size;
font_size = 8;
t2 += sprintf (t2, "`S%d`", font_size);
nl_flag = !0;
break;
case _TAG_H1:
case _TAG_H2:
if (font_size_stackptr) /* âlâXâgé¬É│é╡é»éΩé╬ */
font_size = font_size_stack[--font_size_stackptr];
t2 += sprintf (t2, "`S%d`", font_size);
nl_flag = !0;
break;
case TAG_H3:
case TAG_H4:
case TAG_H5:
case TAG_H6:
font_size_stack[font_size_stackptr++] = font_size;
font_size = 6;
t2 += sprintf (t2, "`S%d`", font_size);
nl_flag = !0;
break;
case _TAG_H3:
case _TAG_H4:
case _TAG_H5:
case _TAG_H6:
if (font_size_stackptr) /* âlâXâgé¬É│é╡é»éΩé╬ */
font_size = font_size_stack[--font_size_stackptr];
t2 += sprintf (t2, "`S%d`", font_size);
nl_flag = !0;
break;
case TAG_TITLE:
tag_title = t1+1;
break;
case _TAG_TITLE:
if ((tag_title != NULL) && ((t1_old - tag_title) < 256)) {
char temp_str[256] = "\"";
/* <title></title> è╘é≡âRâsü[ */
strncpy (temp_str+1, tag_title, (size_t) (t1_old - tag_title));
temp_str[t1_old - tag_title+1] = '"';
CopyItem(xptext->title,temp_str,temp_kmode);
t2 = xptext->text;
t2e = t2 + t2_size - YOYUU;
w = 0;
}
break;
case TAG_HEAD:
tag_head = t1;
break;
case _TAG_HEAD:
/* </head> é≡îƒÅoé╡é╜Ä₧é═â|âCâôâ^é≡âèâZâbâg */
if (tag_head != NULL) {
t2 = t2t = xptext->text;
t2e = t2 + t2_size - YOYUU;
w = 0;
l = xptext->line_ptr;
xptext->line = 0;
xptext->current_line = 0;
}
break;
case TAG_CENTER:
align = ALIGN_CENTER;
tag_center = !0;
break;
case _TAG_CENTER:
tag_center = 0;
reset_align = !0;
nl_flag = !0;
break;
case TAG_SCRIPT:
do {
while ((*t1++ != '/') && (t1 < t1e));
if (!strnicmp (t1, "script", 6)) {
t1 += 6;
nl_flag = !0;
break;
}
} while ((t1 < t1e) && (t2 < t2e));
break;
case TAG_PRE:
tag_pre = !0;
break;
case _TAG_PRE:
tag_pre = 0;
break;
case TAG_OL:
tag_ol = !0;
tag_list_no = 1;
break;
case _TAG_OL:
tag_ol = 0;
break;
case TAG_UL:
tag_ul = !0;
tag_list_no = 1;
break;
case _TAG_UL:
tag_ul = 0;
break;
case TAG_LI:
ffifo[ffifo_ptr++] = 'l';
nl_flag = !0;
break;
case TAG_TABLE:
nl_flag = !0;
break;
case _TAG_TD:
if (w + 6 * 8 > WRAP_DOT) {
not_read_flag = !0;
nl_flag = !0;
} else {
*t2++ = 0x09; /* tab */
w = (w + 6 * 8) / (short) (6 * 8) * (short) (6 * 8);
}
break;
case _TAG_TR:
nl_flag = !0;
break;
case TAG_DT:
nl_flag = !0;
break;
case TAG_DD:
ffifo[ffifo_ptr++] = 'd';
nl_flag = !0;
break;
case TAG_COMMENT:
break;
default: /* é╟é╠â^âOé┼éαé╚é⌐é┴é╜ÅΩìçé═ô╟é▌ö≥é╬é╖ */
break;
}
/* ô╟é▄é╚é⌐é┴é╜é▒é╞é╔é╡é╜é⌐üH */
if (not_read_flag) {
t1 = t1_old;
} else {
t1 = SkipLt (t1, temp_kmode);
}
if (nl_flag)
break;
else
continue;
}
/* ò╢ÄÜâGâôâeâBâeâBé╠Åêù¥ */
if (c == '&') {
/* t1 é╠Äwé╖ò╢ÄÜâGâôâeâBâeâBé≡ entity_no é╔ò╘é╖ */
short entity_no = 0;
char **s = entity_str;
int *l = entity_len;
do {
if (!strnicmp (*s, t1, *l)) {
char t = *(t1 + *l);
if ((t == ' ') || (t == 0x09) || (t == ';') || (t == 0x0a) || (t == 0x0d))
break;
}
s++;
l++;
entity_no++;
} while (*s != NULL);
/* âGâôâeâBâeâBé╔éµé┴é─ò¬è≥ */
switch (entity_no) {
case ENTITY_LT:
case ENTITY_GT:
case ENTITY_AMP:
case ENTITY_QUOT:
case ENTITY_NBSP:
t1 += (strlen (entity_str[entity_no]) + 1);
c = entity_char[entity_no];
break;
default:
/* é╟éΩé┼éαé╚é⌐é┴é╜ÅΩìçé╗é╠é▄é▄ò\Ī */
break;
}
}
if (c == 0x09)
c = ' ';
if (c == ' ') {
if (space_flag) /* Æ╝æOé¬âXâyü[âXé╛é┴é╜é⌐ */
continue;
space_flag = !0;
} else {
space_flag = 0;
}
/* JIS Ä₧é╠è┐ÄÜ IN/OUT âtâëâOé╠Åêù¥ */
if (c == 0x1b) { /* ESC */
/* ò╢ÄÜâRü[âhé¬ö╗éτé╚éóÄ₧é╔ ESC é≡î⌐é┬é»é╜éτ JIS é╞ö╗ÆΦ */
if (temp_kmode == K_AUTO) {
temp_kmode = K_JIS;
McDbPrint ("JIS é╞ö╗ÆΦ\n");
}
if (temp_kmode == K_JIS) {
unsigned char c1 = *(t1 + 1);
switch (*t1) {
case '(':
if ((c1 == 'B') || (c1 == 'J')) { /* è┐ÄÜ OUT */
aork = 0;
t1 += 2;
}
break;
case '$':
if ((c1 == '@') || (c1 == 'B')) { /* è┐ÄÜ IN */
aork = !0;
t1 += 2;
}
break;
default:
break;
}
continue;
}
}
/* ò╢ÄÜâRü[âhé¬é▄é╛ö╗éτé╚éóÄ₧ */
if (temp_kmode == K_AUTO) {
/* 0x81~0x9f é≡î⌐é┬é»é╜éτ SJIS é╞ö╗ÆΦ */
if ((c >= 0x81) && (c <= 0x9f)) {
temp_kmode = K_SJIS;
McDbPrint ("SJIS é╞ö╗ÆΦ\n");
}
/* 0xa1~0xcf é≡î⌐é┬é»é╜éτ EUC é╞ö╗ÆΦ */
if ((c >= 0xa1) && (c <= 0xcf)) {
temp_kmode = K_EUC;
McDbPrint ("EUC é╞ö╗ÆΦ\n");
}
}
if (c == 0x0d) {
aork = 0;
org_line++;
if (*t1 == 0x0a)
t1++;
if (!tag_pre)
continue; /* ăé╠ò╢ÄÜé╓ */
else
break; /* ăé╠ìsé╓ */
}
if (c == 0x0a) {
aork = 0;
org_line++;
if (!tag_pre)
continue; /* ăé╠ò╢ÄÜé╓ */
else
break; /* ăé╠ìsé╓ */
}
if (c < ' ') {
//*t2++ = c;
continue;
}
if (((c == '`') && (temp_kmode <= K_EUC)) /* AUTO or SJIS or EUC */
||((temp_kmode == K_JIS) && (!aork) && (c == '`'))) {
if (w + font_size > WRAP_DOT) {
t1 = t1_old; /* ô╟é▄é╚é⌐é┴é╜é▒é╞é╔é╖éΘ */
break;
}
*t2++ = c;
if (font_size * 2 > LINE_Y)
InsertNodeBLB (1, c, 0, font_size, w, 0, 0, 0);
w += font_size;
*t2++ = c;
if (font_size * 2 > LINE_Y)
InsertNodeBLB (1, c, 0, font_size, w, 0, 0, 0);
w += font_size;
continue;
}
//if ((c >= 0xa0) && (c <= 0xdf)) /* ö╝èpâJâié═û│Äï */
//continue;
if (((temp_kmode <= K_EUC) && (c < 0x80)) /* AUTO or SJIS or EUC */
||((temp_kmode == K_JIS) && (!aork))) {
/* éPâoâCâgò╢ÄÜé╠ÅΩìç */
if (w + font_size > WRAP_DOT) {
t1 = t1_old; /* ô╟é▄é╚é⌐é┴é╜é▒é╞é╔é╖éΘ */
break;
}
*t2++ = c;
if (font_size * 2 > LINE_Y)
InsertNodeBLB (1, c, 0, font_size, w, 0, 0, 0);
w += font_size;
continue;
} else {
/* è┐ÄÜé╠ÅΩìç */
unsigned char c1;
if ((w + font_size * 2) > WRAP_DOT) {
t1 = t1_old; /* ô╟é▄é╚é⌐é┴é╜é▒é╞é╔é╖éΘ */
break;
}
switch (temp_kmode) {
case K_AUTO:
case K_SJIS:
*t2++ = c;
*t2++ = *t1++;
break;
case K_EUC:
Jis2sjis (((c & 0x7f)), (*t1++ & 0x7f), t2);
break;
case K_JIS:
Jis2sjis (c, *t1++, t2);
break;
}
c1 = *(t2 - 1);
if (font_size * 2 > LINE_Y)
InsertNodeBLB (1, c, c1, font_size, w, 0, 0, 0);
w += font_size * 2;
continue;
}
} while ((t1 < t1e) && (t2 < t2e));
if ((t1 > t1e) || (t2 > t2e))
break;
if (align == ALIGN_CENTER)
l->start_dot = (WRAP_DOT - w) / 2;
else
l->start_dot = 0;
l->org_line = org_line;
if (reset_align) {
align = ALIGN_LEFT;
reset_align = 0;
}
if (blb_top == NULL) {
l->num = t2 - t2t;
l++->ptr = t2t;
xptext->line++; /* ìsÉö */
} else { /* æOìsÅêù¥é¬òKùvé╚ÅΩìç */
unsigned char temp[1024];
int len1; /* î╗ì▌ìsé╠ò╢ÄÜÉö */
int len2; /* æOìsé╠ò╢ÄÜÉö */
unsigned short s = l->start_dot;
BLB *t_ptr;
len1 = (int) (t2 - t2t);
strncpy (temp, t2t, len1); /* î╗ì▌ìsé≡æ▐ö≡ */
t2 = t2t;
while ((t_ptr = DeleteNodeBLB ())!= NULL) {
l->ptr = t2;
strcpy (t2, t_ptr->text);
len2 = strlen (t_ptr->text);
l->num = len2;
t2 += len2;
l->start_dot = s;
l->org_line = org_line;
xptext->line++; /* ìsÉö */
l++;
free (t_ptr);
}
l->ptr = t2;
strcpy (t2, temp);
l->num = len1;
t2 += len1;
l->start_dot = s;
l->org_line = org_line;
xptext->line++; /* ìsÉö */
l++;
}
} while ((t1 < t1e) && (t2 < t2e) && (xptext->line < line_table_size));
l->ptr = NULL;
xptext->kmode = temp_kmode;
if (t2 >= t2e)
McPrint ("üª âeâLâXâgë≡É═âoâbâtâ@é¬æ½éΦé▄é╣é±\n");
if ((xptext->line >= line_table_size))
McPrint ("üª ìsô¬âeü[âuâïé¬æ½éΦé▄é╣é±\n");
/* ù]ò¬é╔èmò█é╡é╜âüâéâèâuâìâbâNé≡É╪éΦÄ╠é─éΘ */
_dos_setblock (xptext->text, (int) t2 - (int) (xptext->text));
_dos_setblock (xptext->line_ptr, sizeof (LINE_PTR) * (xptext->line));
if (!pass) { /* Åëë±é╠ë≡É═é╚éτ */
if (link_table_buffer_ptr - xptext->link_table_buffer) {
_dos_setblock (xptext->link_table_buffer, sizeof (char)
* ((int) (link_table_buffer_ptr - xptext->link_table_buffer)));
} else {
_dos_mfree (xptext->link_table_buffer);
xptext->link_table_buffer = NULL;
}
if (xptext->link_table_max) {
_dos_setblock (xptext->link_table, sizeof (LINK_TABLE) * (xptext->link_table_max));
} else {
_dos_mfree (xptext->link_table);
xptext->link_table = NULL;
}
if (xptext->image_table_max) {
_dos_setblock (xptext->image_table, sizeof (IMAGE_TABLE) * (xptext->image_table_max));
} else {
_dos_mfree (xptext->image_table);
xptext->image_table = NULL;
}
}
return (xptext);
}
/* âèâôâNâeü[âuâïé╠ in_cache é≡ìXÉVé╖éΘ */
void ReCheckLinkTable (XPTEXT * xptext)
{
HTTPFILE *httpfile = alloca (sizeof (HTTPFILE));
char temp_fname[256];
int i;
for (i = 0; i < xptext->link_table_max; i++) {
strcpy (httpfile->url, xptext->link_table[i].url);
if (WCExist (httpfile, temp_fname) > WC_NON)
(xptext->link_table)[i].in_cache = !0;
else
(xptext->link_table)[i].in_cache = 0;
}
}
/* âAâôâJü[é≡îƒì⌡é╡é─ìsÉöé≡ò╘é╖ */
int SearchAnchor (XPTEXT * xptext, char *anchor)
{
int i;
for (i = 0; i < xptext->anchor_table_max; i++) {
/* anchor+1 é╚é╠é═ '#' é≡ö≥é╬é╖é╜é▀ */
if (!stricmp (((xptext->anchor_table)[i]).anchor, anchor + 1))
return (((xptext->anchor_table)[i]).line);
}
return (0);
}
void FreeXptext (XPTEXT * xptext)
{
if (xptext != NULL) {
if (xptext->text != NULL)
_dos_mfree (xptext->text);
if (xptext->line_ptr != NULL)
_dos_mfree (xptext->line_ptr);
if (xptext->anchor_table != NULL)
_dos_mfree (xptext->anchor_table);
/*
link_table, link_table_buffer, image_table é═é▒é▒é┼Ä╠é─é─é═éóé»é╚éóüBù¥ùRé═We
bXpression.c é╠ FreeXptext() î─é╤Åoé╡òöé≡î⌐éΘé▒é╞üiòíÉöë±ë≡É═é≡ìséñôxé╔é▒é▒é¬î─é╬
éΩéΘé╜é▀üj
*/
_dos_mfree (xptext);
}
}
void FreeXptext2 (XPTEXT * xptext)
{
short i;
if (xptext != NULL) {
if (xptext->link_table != NULL)
_dos_mfree (xptext->link_table);
if (xptext->link_table_buffer != NULL)
_dos_mfree (xptext->link_table_buffer);
if (xptext->image_table != NULL) {
for (i = 0; i < xptext->image_table_max; i++) {
IMAGE_LIST *t_ptr;
t_ptr = (xptext->image_table)[i].image_list;
t_ptr->count--; /* âèâôâNâJâEâôâgé≡éPé┬ë║é░éΘ */
}
_dos_mfree (xptext->image_table);
}
}
}